From 5f0abc8e9c1be7c5cc3462fd3ddb4ebe50ee5d46 Mon Sep 17 00:00:00 2001 From: robertl Date: Tue, 3 Jun 2003 18:14:29 +0000 Subject: [PATCH] Make rtrim work sensibly when passed null pointers or pointers to empty strings. git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@379 f51c46e8-681c-474f-0cfe-069cfd0219fb --- gpsbabel/util.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gpsbabel/util.c b/gpsbabel/util.c index 52cfb4c19..06656b4e0 100644 --- a/gpsbabel/util.c +++ b/gpsbabel/util.c @@ -194,6 +194,10 @@ pstrdup(char *src) void rtrim(char *s) { + if (!s || !*s) { + return; + } + while (*s) { s++; } -- 2.30.2